package com.stbu.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.stbu.bean.UserBean;
import com.stbu.service.UserService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequiredArgsConstructor
@RequestMapping("/user")
public class UserController {
    private final UserService userService;

    @PostMapping("")
    public UserBean queryUserByName(@RequestBody UserBean userBean) {
        LambdaQueryWrapper<UserBean> lqw = new LambdaQueryWrapper<>();
        lqw.eq(UserBean::getUname,userBean.getUname());
        UserBean u1 = userService.getOne(lqw);
        return u1;
    }
}
